<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>代码生成器界面</title>
<style type="text/css">
table{border-collapse:collapse;border-spacing:0;border-left:1px solid #888;border-top:1px solid #888;background:#efefef;}
th,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
</style>
<script type="text/javascript" src="${pageContext.request.contextPath}/statics/js/jquery.1.11.3.min.js"></script>
<script type="text/javascript">
$(function(){
	$("#settingsTable").find("td").each(function(){
		$(this).click(function(){
			var chk = $(this).find(":checkbox");
			chk.prop('checked', !chk.prop('checked'));
		});
	});
	
});

</script>
</head>
<body>
	<form action="${pageContext.request.contextPath}/col_settings" method="post">
		<select name="tableName">
			<c:forEach items="${tableList}" var="table">
				<option value="${table[0]}"  ${table[0] == tableName ? "selected" : ""}>${table[1]}</option>
			</c:forEach>
		</select>
		<input type="submit" value="查询"/>
		<br/><br/>
	</form>

	<form action="${pageContext.request.contextPath}/update_col_settings" method="post">
		<input type="submit" value="保存设置"/><br/><br/>
		<input type="hidden" name="tableName" value="${tableName}">
		<table id ="settingsTable">
			<tr>
				<td>列名</td>
				<td>中文注释</td>
				<td>是否查询条件</td>
				<td>显示条件类型</td>
				<td>
					是否在列表中显示
				</td>
				<td>
					是否在编辑页面显示
				</td>
				<td>
					在insert<br/>
					语句中使用默认值</td>
				<td>
					在controller<br/>
					中使用默认值设置
				</td>
			</tr>
			
			<c:forEach items="${colList}" var="col">
				<tr>
					<td>${col.colName}</td>
					<td>${col.colCom}</td>
					<td><input name="condition" type="checkbox" ${col.condition=='y'?"checked='checked'":""}  value="${col.propertyName}" ></td>
					<td>
						<select name="condition_type"type="checkbox" >
							<option value="input" ${col.conditionType=='input'?'selected':''}>文本框</option>
							<option value="dropdown" ${col.conditionType=='dropdown'?'selected':''}>下拉框</option>
						</select>
					</td>
					<td><input name="show_list" type="checkbox" ${col.showList=='y'?"checked='checked'":""} value="${col.propertyName}" ></td>
					<td><input name="show_form" type="checkbox"  ${col.showForm=='y'?"checked='checked'":""}  value="${col.propertyName}" ></td>
					<td><input name="insert_default"  value="${((col.propertyName=='createTime' || col.propertyName == 'modifyTime') && (col.insertDefault == null || col.insertDefault == 'ng'))?'now()':((col.insertDefault == 'ng'?'':col.insertDefault))}"/></td>
					<td><input name="controller_default" value="${(col.controllerDefault=='ng' || col.controllerDefault=='NG')?"":col.controllerDefault}" /></td>
				</tr>
			</c:forEach>
		</table>
	</form>
	
</body>
</html>